package com.usian.user.controller;

import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.common.enums.AppHttpCodeEnum;
import com.usian.model.user.dtos.AuthDto;
import com.usian.user.ApUserRealNameControllerApi;
import com.usian.user.service.ApUserRealnameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/auth")
@Api(value = "用户资格认证",tags = "用户资格认证",description = "")
public class ApUserRealNameController implements ApUserRealNameControllerApi {

    @Autowired
    private ApUserRealnameService service;

    @Override
    @PostMapping("/list")
    @ApiOperation(value = "根据状态展示信息",notes = "")
    public ResponseResult loadListByStatus(@RequestBody AuthDto dto) {

        return service.loadListByStatus(dto);

    }

    @Override
    @PostMapping("/passAndFail")
    public ResponseResult passAndFail(@RequestBody AuthDto dto) {
        if (dto == null || dto.getStatus() == null){
            return ResponseResult.errorResult(AppHttpCodeEnum.PARAM_REQUIRE);
        }
        return service.passAndFail(dto);

    }

}
